#include "packet_1_1.h"
#include "player.h"
#include "monster.h"

void PacketPlayerData::pack (Player& pl)
{
		uid = pl.uniqueID;
		name = pl.name ;
		x = pl.x ;
		y = pl.y ;
		hp = pl.data.hp ;
		mp = pl.data.mp ;		
//		skill = pl.nextSkill ;
}

void PacketPlayerData::unpack (Player& pl)
{
	pl.uniqueID = uid;
	pl.name = name;
	pl.x = x ;
	pl.y = y;
	pl.data.hp = hp ;
	pl.data.mp = mp ;	
	//pl.nextSkill = skill ;
}

PacketPlayerData::PacketPlayerData ():BasePacket (ID_PKT_PLAYER_DATA)
{
}



void PacketMainPlayerData::pack( Player& pl )
{
	
	name = pl.name ;
	uid = pl.getUID() ;
	x = pl.x ;
	y = pl.y ;
	hp = pl.data.hp ;
	mp = pl.data.mp ;	
	//skill = pl.nextSkill ;
}

void PacketMainPlayerData::unpack ( Player& pl)
{
	pl.uniqueID = uid ;
	pl.name = name ;
	pl.x = x ;
	pl.y = y ;
	pl.data.hp = hp ;
	pl.data.mp = mp ;	
	//pl.nextSkill = skill ;
}

PacketMainPlayerData::PacketMainPlayerData():BasePacket (ID_PKT_MAINPLAER_DATA)
{
}
void PacketMonsterData::pack (Monster& m) 
{
	uid = m.getUID() ;	
	x = m.targetX ;
	y = m.targetY ;
	speed = m.speed;
	monsterID = m.getID();
	// hp = m.data.getHP() ;
	 
}
void PacketMonsterData::unpack (Monster& m) 
{	
	
	m.uniqueID = uid ;
	m.speed = speed;
	m.targetX = x ;
	m.targetY = y ;	
	//m.data.hp = hp ;
}
PacketMonsterData::PacketMonsterData () :BasePacket(ID_PKT_MONSTER_DATA)
{

}


